import java.math.BigDecimal;

public class SavingsAcnt extends Account
{
	public SavingsAcnt(double bal, double rate, Account ofl, Account ufl,
			Account ira, double lThresh, double hThresh)
	{
		name = "Savings";
		balance = bal;
		anualInterestRate = rate;
		monthlyInterestRate = rate / 12;
		overFlowAccount = ofl;
		underFlowAccount = ufl;
		interestRecievingAccount = ira;
		lowThreshold = lThresh;
		highThreshold = hThresh;
	}

	public SavingsAcnt()
	{
	}

	@Override
	public void deposit(double amount)
	{
		balance += amount;
	}

	@Override
	public double withdraw(double amount)
	{
		if (balance < amount)
		{
			throw new IllegalStateException("Savings has Insufficient Funds");
		} else
		{
			balance -= amount;
			return amount;
		}
	}

	@Override
	public void doTimeTick()
	{
		double interest = balance * monthlyInterestRate;
		balance += interest;
	}

}
